class Admin::Umbrella < ActiveRecord::Base
  include Rails.application.routes.url_helpers
  mount_uploader :avatar, AvatarUploader

  def to_jq_upload
    {
      "name" => read_attribute(:avatar),
      "size" => avatar.size,
      "url" => avatar.url,
      "thumbnail_url" => avatar.thumb.url,
      "delete_url" => admin_umbrella_path(:id => id),
      "delete_type" => "DELETE" 
    }
  end

  def category_name
    name = case category
           when 1 then "gardenUmbrella"
           when 2 then "beachUmbrella"
           when 3 then "petUmbrella"
           when 4 then "specialStylesUmbrella"
           when 5 then "foldingUmbrella"
           when 6 then "straightUmbrella"
           when 7 then "kidsUmbrellas"
           end
  end
end
